﻿using System;
using System.Collections;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml.Linq;
using System.Collections.Generic;
using System.Data;

using EHTWebsite.Code;
/// <summary>
/// Summary description for WebService
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
[System.Web.Script.Services.ScriptService]
public class WebService : System.Web.Services.WebService
{

    public WebService()
    {

    }

    [WebMethod]
    public List<EHTWebsite.Code.BanDo> GetBanDos()
    {
        Boolean IsVN = true;
        try
        {
            String languageCode = Session[HangSo.LANGUAGE_CODE].ToString();

            if (languageCode == "en-us")
            {
                IsVN = false;
            }

        }
        catch (Exception ex)
        {
        }

        List<EHTWebsite.Code.BanDo> theBanDos = new List<EHTWebsite.Code.BanDo>();
        DataSet dsBanDos = BanDoProvider.GetBanDosForFrontEnd(IsVN);

        EHTWebsite.Code.BanDo theBanDo;

        if (dsBanDos.Tables[0].Rows.Count > 0)
        {
            foreach (DataRow dr in dsBanDos.Tables[0].Rows)
            {
                theBanDo = null;
                theBanDo = new EHTWebsite.Code.BanDo();
                theBanDo.ID = Int32.Parse(dr["ID"].ToString());
                theBanDo.MoTa = dr["MoTa"].ToString();
                theBanDo.ToaDo = dr["ToaDo"].ToString();
                theBanDos.Add(theBanDo);
            }
        }
        return theBanDos;
    }

}

